// AmfObject.h: interface for the AmfObject class.
//
//////////////////////////////////////////////////////////////////////

#if !defined(AFX_AMFOBJECT_H__5B369AA6_BFEC_446D_BBCF_0CE98C023687__INCLUDED_)
#define AFX_AMFOBJECT_H__5B369AA6_BFEC_446D_BBCF_0CE98C023687__INCLUDED_

#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000

#include "amf3_types.h"
#include "../basic/milli_time.h"
#include <map>
#include <sstream>

namespace Amf {

	using namespace HT;
	using namespace std;
	typedef unsigned char byte;
	typedef StdArray<byte> StdByteArray;

	class AmfObject;
	class AmfInt;
	class AmfString;
	class AmfDouble;
	class AmfBool;
	class AmfByteArray;
	class AmfArray;
	class AmfMap;
	class AmfAsObject;
	class AmfIterator;
	class AmfDate;
	class AmfExArrayInt;
	class AmfExArrayFloat64;

	typedef HPtr<AmfObject> AmfObjectPtr;
	typedef HPtr<AmfInt> AmfIntPtr;
	typedef HPtr<AmfString> AmfStringPtr;
	typedef HPtr<AmfDouble> AmfDoublePtr;
	typedef HPtr<AmfBool> AmfBoolPtr;
	typedef HPtr<AmfByteArray> AmfByteArrayPtr;
	typedef HPtr<AmfArray> AmfArrayPtr;
	typedef HPtr<AmfMap> AmfMapPtr;
	typedef HPtr<AmfAsObject> AmfAsObjectPtr;
	typedef StdArray<AmfObjectPtr> AmfObjectArray;
	typedef HPtr<AmfIterator> AmfIteratorPtr;
	typedef HPtr<AmfDate> AmfDatePtr;
	typedef HPtr<AmfExArrayInt> AmfExArrayIntPtr;
	typedef HPtr<AmfExArrayFloat64> AmfExArrayFloat64Ptr;

	typedef std::map<wstring, AmfObjectPtr> MapStrPtr;

	extern wstring AMF_FUNC_EXPORT AToW (const char * pStrA);
	extern wstring AMF_FUNC_EXPORT AToW (const string& StrA);
	extern string AMF_FUNC_EXPORT WToA (const wchar_t* pStrW);
	extern string AMF_FUNC_EXPORT WToA (const wstring& StrW);
	extern string AMF_FUNC_EXPORT WToU8(const wstring& StrW);
	extern string AMF_FUNC_EXPORT WToU8(const wchar_t* pStrW, int32 len = -1);
	extern wstring AMF_FUNC_EXPORT U8ToW(const string& StrU8);
	extern wstring AMF_FUNC_EXPORT U8ToW(const char * pStrU8, int32 len = -1);

	class AMF_CLASS_EXPORT AmfIterator : public Object
	{
		OBJ_CLASS_INFO(AmfIterator)
	public:
		virtual void MoveFirst () = 0;
		virtual void MoveNext () = 0;
		virtual bool Eof () = 0;
		virtual AmfObjectPtr Get () = 0;
		virtual wstring GetKey () = 0;

		// GetValue
		inline int32 AsInt ();
		inline float64 AsDouble ();
		inline wstring AsString ();
	};

	class AMF_CLASS_EXPORT AmfObject : public Object
	{
		OBJ_CLASS_INFO(AmfObject)
	public:
		virtual int32 DataType()
		{
			return AMF3_UNDEFINED;
		};

		virtual ~AmfObject () {}
		virtual int32 GetChildNumber() { return 0; }
		virtual int32 ToInt () { throw HT::Except (HT_AMF_CONVERT_INT, "can't convert to int"); }
		virtual double ToDouble () { throw HT::Except (HT_AMF_CONVERT_DOUBLE, "can't convert to double"); }
		virtual wstring ToString () { throw HT::Except (HT_AMF_CONVERT_STRING, "can't convert to string"); }
		//virtual string ToStringA ()	{ throw HT::Except (HT_AMF_CONVERT_STRING, "can't convert to string"); }
		virtual MilliTime ToTime() { throw HT::Except (HT_AMF_CONVERT_TIME, "can't convert to time"); }
		virtual AmfObjectPtr Item (int i) { throw HT::Except (HT_AMF_NOT_ARRAY, "not support operation Item[i]"); }
		virtual AmfObjectPtr Item (const wchar_t* str) { throw HT::Except (HT_AMF_NOT_ASOBJECT, "not support operation Item['name']"); }
		virtual AmfObjectPtr Item (const wstring& str) { return Item(str.c_str()); }
		virtual AmfIteratorPtr GetChildIterator ();
		//bool IsNull () { return (this == GetNull()); }
		static AmfObjectPtr GetNullObject ();
	};

	class AMF_CLASS_EXPORT AmfString : public AmfObject
	{
		OBJ_CLASS_INFO(AmfString)
	public:

		const wchar_t* GetValue() const
		{
			return m_strValue.c_str();
		}

		StdString GetValueU8() const
		{
			return WToU8(m_strValue.c_str());
		}

		void SetValue(const wchar_t* value)
		{
			m_strValue = value;
		}

		void SetValueA(const char * value)
		{
			m_strValue = AToW(value);
		}

		virtual int32 DataType()
		{
			return AMF3_STRING;
		};

		virtual int32 ToInt () { return _wtoi(m_strValue.c_str());	}
		virtual double ToDouble ()
		{	wchar_t * pend; return wcstod(m_strValue.c_str(), &pend); }
		virtual wstring ToString () { return m_strValue;	}
		//virtual string ToStringA() { return WToA(m_strValue); }	
	private:
		wstring m_strValue;
	};

	class AMF_CLASS_EXPORT AmfInt : public AmfObject
	{
		OBJ_CLASS_INFO(AmfInt)
	public:

		void SetValue(int32 value)
		{
			m_iValue = value;
		}
		
		int32 GetValue()
		{
			return m_iValue;
		}

		virtual int32 DataType()
		{
			return AMF3_INTEGER;
		};

		virtual int32 ToInt () { return m_iValue; }
		virtual double ToDouble () { return m_iValue; }
		virtual wstring ToString () {
			wchar_t buf[30];
//#ifdef _WIN32
#ifndef __linux_
			swprintf(buf, L"%d", m_iValue);
#else	// _WIN32
			swprintf(buf, 20, L"%d", m_iValue);
#endif
			return wstring(buf);
		}
		//virtual string ToStringA() { return WToA( ToStringW()); }
	private:
		int32 m_iValue;
	};

	class AMF_CLASS_EXPORT AmfDouble : public AmfObject
	{
		OBJ_CLASS_INFO(AmfDouble)
	public:

		void SetValue(float64 value)
		{
			m_dValue = value;
		}
		
		float64 GetValue()
		{
			return m_dValue;
		}
		
		virtual int32 DataType()
		{
			return AMF3_NUMBER;
		};

		virtual int32 ToInt () { return (int32)m_dValue; }
		virtual double ToDouble () { return m_dValue; }
		virtual wstring ToString () {
			wchar_t buf[20];
#ifdef _WIN32
			swprintf(buf, L"%g", m_dValue);
#else	// _WIN32
			swprintf(buf, 20, L"%g", m_dValue);
#endif
			return wstring(buf);
		}
		//virtual string ToStringA() { return WToA( ToStringW() );}

	private:
		float64 m_dValue;
	};


	class AMF_CLASS_EXPORT AmfBool : public AmfObject
	{
		OBJ_CLASS_INFO(AmfBool)
	public:

		void SetValue(bool value)
		{
			m_bValue = value;
		}
		
		bool GetValue()
		{
			return m_bValue;
		}

		virtual int32 DataType()
		{
			return AMF3_TRUE;
		};

		virtual int32 ToInt () { return m_bValue ? 1 : 0; }
		virtual double ToDouble () { return m_bValue ? 1 : 0; }
		virtual wstring ToString () {	return wstring(m_bValue ? L"true" : L"false");	}
		//virtual string ToStringA() { return WToA( ToStringW() ); }
	private:
		bool m_bValue;
	};


	class AMF_CLASS_EXPORT AmfDate : public AmfObject
	{
		OBJ_CLASS_INFO(AmfDate)
	public:

		void SetValue(const MilliTime& value)
		{
			m_dValue = value;
		}

		// V'V5D8J=
		//	yyyy-mm-dd HH:MM:SS.XXX
		//	yyyy-mm-dd HH:MM:SS
		//	yyyy-mm-dd 
		//	yyyy/mm/dd HH:MM:SS.XXX
		//	yyyy/mm/dd HH:MM:SS
		//	yyyy/mm/dd 
		void SetValue(const wchar_t* pDateText)	{	m_dValue.SetUTCByStringW(pDateText);}
		void SetValue(const wstring& strDateText)	{	SetValue(strDateText.c_str()); }

		MilliTime& GetValue()
		{
			return m_dValue;
		}

		virtual int32 DataType()
		{
			return AMF3_DATE;
		};

		virtual int32 ToInt ()		{ return m_dValue.GetTime(); }
		virtual double ToDouble ()	{ return (double)m_dValue.GetTime() * 1000 + m_dValue.GetMillisecond(); }
		virtual wstring ToString ()	{ return m_dValue.ToStringW();	}
		//virtual string ToStringA() { return m_dValue.ToStringA(); }
		virtual MilliTime ToTime()	{ return m_dValue; }

	private:
		MilliTime m_dValue;
	};

	class AMF_CLASS_EXPORT AmfByteArray : public AmfObject
	{
		OBJ_CLASS_INFO(AmfByteArray)
	public:

		void SetValue(const StdByteArray& value)
		{
			m_byteAry = value;
		}
		
		StdByteArray& GetValue()
		{
			return m_byteAry;
		}

		virtual int32 DataType()
		{
			return AMF3_BYTEARRAY;
		};

		void Compress();

		void Uncompress();

		virtual int32 GetChildNumber() { return m_byteAry.size(); }

	private:
		StdByteArray m_byteAry;
	};

	class AMF_CLASS_EXPORT AmfArray : public AmfObject
	{
		OBJ_CLASS_INFO(AmfArray)
	public:
		virtual ~AmfArray ()
		{
		}

		void AddData (bool i)
		{
			AmfBoolPtr pB(HP_NEW);
			pB->SetValue(i);
			m_ObjAry.push_back(pB);
		}

		void AddData(int32 i)
		{
			AmfIntPtr pI(HP_NEW);
			pI->SetValue(i);
			m_ObjAry.push_back(pI);
		}

		void AddData(const wstring& str)
		{
			AmfStringPtr pStr(HP_NEW);
			pStr->SetValue(str.c_str());
			m_ObjAry.push_back(pStr);
		}

		void AddData(const string& str)
		{
			wstring temp = AToW(str);
			AddData(temp);
		}

		void AddData(const char* str)
		{
			wstring temp = AToW(str);
			AddData(temp);
		}

		void AddData(LPCWSTR str)
		{
			AmfStringPtr pStr(HP_NEW);
			pStr->SetValue(str);
			m_ObjAry.push_back(pStr);
		}

		void AddData(float64 d)
		{
			AmfDoublePtr pD(HP_NEW);
			pD->SetValue(d);
			m_ObjAry.push_back(pD);
		}

		void AddData(const MilliTime& t)
		{
			AmfDatePtr pD(HP_NEW);
			pD->SetValue(t);
			m_ObjAry.push_back(pD);
		}

		void AddData(AmfObjectPtr obj)
		{
			if (NULL == obj)
				obj = GetNullObject();
			m_ObjAry.push_back(obj);
		}

		void Set(int32 i, bool v)
		{
			AmfBoolPtr pB(HP_NEW);
			pB->SetValue(v);
			Set(i, pB);
		}

		void Set(int32 i, int32 v)
		{
			AmfIntPtr pI(HP_NEW);
			pI->SetValue(v);
			Set(i, pI);
		}

		void Set(int32 i, const wstring& str)
		{
			AmfStringPtr pStr(HP_NEW);
			pStr->SetValue(str.c_str());
			Set(i, pStr);
		}

		void Set(int32 i, LPCWSTR str)
		{
			AmfStringPtr pStr(HP_NEW);
			pStr->SetValue(str);
			Set(i, pStr);
		}

		void Set(int32 i, float64 d)
		{
			AmfDoublePtr pD(HP_NEW);
			pD->SetValue(d);
			Set(i, pD);
		}

		void Set(int32 i, const MilliTime& t)
		{
			AmfDatePtr pD(HP_NEW);
			pD->SetValue(t);
			Set(i, pD);
		}

		void Set(int32 i, AmfObjectPtr obj)
		{
			if (i < m_ObjAry.size())
			{
				if (NULL == obj)
					obj = GetNullObject();
				m_ObjAry[i] = obj;
			}
			else
				throw HT::Except (HT_AMF_OVERFLOW, "Array overflow");
		}

		bool DeleteData (int32 i)
		{
			if (i < m_ObjAry.size())
				m_ObjAry.erase(m_ObjAry.begin() + i);
			else
				throw HT::Except (HT_AMF_OVERFLOW, "Array overflow");
			return false;
		}

		virtual AmfObjectPtr Item (int i)
		{ 
			if (i < m_ObjAry.size())
				return m_ObjAry[i];
			else
				throw HT::Except (HT_AMF_OVERFLOW, "Array overflow");
		}

		void SetValue(const AmfObjectArray& value)
		{
			m_ObjAry = value;
		}
		
		AmfObjectArray& GetValue()
		{
			return m_ObjAry;
		}

		bool isMap()
		{
			return false;
		}
		
		bool isEmpty()
		{
			return m_ObjAry.size() == 0;
		}

		int Size()
		{
			return m_ObjAry.size();
		}

		virtual int32 DataType()
		{
			return AMF3_ARRAY;
		};

		virtual int32 GetChildNumber() { return m_ObjAry.size(); }
		virtual AmfIteratorPtr GetChildIterator();
		
	private:
		AmfObjectArray m_ObjAry;
	};

	class AMF_CLASS_EXPORT AmfExArrayInt : public AmfObject
	{
		OBJ_CLASS_INFO(AmfExArrayInt)
	public:
		virtual ~AmfExArrayInt ()
		{
		}

		void AddData(int32 v)
		{
			m_ObjAry.push_back(v);
		}

		void Set(int32 i, int32 v)
		{
			if (i < m_ObjAry.size())
				m_ObjAry[i] = v;
			else
				throw HT::Except (HT_AMF_OVERFLOW, "Array overflow");
		}

		bool DeleteData (int32 i)
		{
			if (i < m_ObjAry.size())
				m_ObjAry.erase(m_ObjAry.begin() + i);
			else
				throw HT::Except (HT_AMF_OVERFLOW, "Array overflow");
			return false;
		}

		virtual AmfObjectPtr Item (int i)
		{ 
			if (i < m_ObjAry.size())
			{
				AmfIntPtr pI(HP_NEW);
				pI->SetValue(m_ObjAry[i]);
				return pI;
			}
			else
				throw HT::Except (HT_AMF_OVERFLOW, "Array overflow");
		}

		void SetValue(const StdIntArray& value)
		{
			m_ObjAry = value;
		}

		StdIntArray& GetValue()
		{
			return m_ObjAry;
		}

		bool isMap()
		{
			return false;
		}

		bool isEmpty()
		{
			return m_ObjAry.size() == 0;
		}

		int Size()
		{
			return m_ObjAry.size();
		}

		virtual int32 DataType()
		{
			return AMF3_ARRAY_EX_INT32;
		};

		virtual int32 GetChildNumber() { return m_ObjAry.size(); }
		virtual AmfIteratorPtr GetChildIterator();

	private:
		StdIntArray m_ObjAry;
	};

	class AMF_CLASS_EXPORT AmfExArrayFloat64 : public AmfObject
	{
		OBJ_CLASS_INFO(AmfExArrayFloat64)
	public:
		virtual ~AmfExArrayFloat64 ()
		{
		}

		void AddData(float64 v)
		{
			m_ObjAry.push_back(v);
		}


		void Set(int32 i, float64 v)
		{
			if (i < m_ObjAry.size())
				m_ObjAry[i] = v;
			else
				throw HT::Except (HT_AMF_OVERFLOW, "Array overflow");
		}

		bool DeleteData (int32 i)
		{
			if (i < m_ObjAry.size())
				m_ObjAry.erase(m_ObjAry.begin() + i);
			else
				throw HT::Except (HT_AMF_OVERFLOW, "Array overflow");
			return false;
		}

		virtual AmfObjectPtr Item (int32 i)
		{ 
			if (i < m_ObjAry.size())
			{
				AmfDoublePtr pF(HP_NEW);
				pF->SetValue(m_ObjAry[i]);
				return pF;
			}
			else
				throw HT::Except (HT_AMF_OVERFLOW, "Array overflow");
		}

		void SetValue(const StdDoubleArray& value)
		{
			m_ObjAry = value;
		}

		StdDoubleArray& GetValue()
		{
			return m_ObjAry;
		}

		bool isMap()
		{
			return false;
		}

		bool isEmpty()
		{
			return m_ObjAry.size() == 0;
		}

		int Size()
		{
			return m_ObjAry.size();
		}

		virtual int32 DataType()
		{
			return AMF3_ARRAY_EX_FLOAT64;
		};

		virtual int32 GetChildNumber() { return m_ObjAry.size(); }
		virtual AmfIteratorPtr GetChildIterator();

	private:
		StdDoubleArray m_ObjAry;
	};

	class AMF_CLASS_EXPORT AmfMap : public AmfObject
	{
		OBJ_CLASS_INFO(AmfMap)
	public:

		void AddData(wstring str, AmfObjectPtr obj)
		{
			m_ObjMap[str] = obj;
		}

		void SetValue(const MapStrPtr& value)
		{
			m_ObjMap = value;
		}
		
		MapStrPtr& GetValue()
		{
			return m_ObjMap;
		}

		bool isMap()
		{
			return true;
		}
		
		virtual int32 DataType()
		{
			return AMF3_ARRAY;
		};

		virtual int32 GetChildNumber() { return m_ObjMap.size(); }
		virtual AmfIteratorPtr GetChildIterator();

	private:
		MapStrPtr m_ObjMap;
	};

	class AMF_CLASS_EXPORT AmfAsObject : public AmfObject
	{
		OBJ_CLASS_INFO(AmfAsObject)
	public:

		void SetName(const wchar_t* str)
		{
			if(str == NULL)
				m_strName = L"";
			else
				m_strName = str;
		}

		wstring GetName()
		{
			return m_strName;
		}

		void AddData(wstring str, int32 i)
		{
			AmfIntPtr pI(HP_NEW);
			pI->SetValue(i);
			m_DataMap[str] = pI;
		}
		
		void AddData(wstring str, bool b)
		{
			AmfBoolPtr pB(HP_NEW);
			pB->SetValue(b);
			m_DataMap[str] = pB;
		}

		void AddData(wstring str, const wchar_t* strV)
		{
			AmfStringPtr pStr(HP_NEW);
			pStr->SetValue(strV);
			m_DataMap[str] = pStr;
		}
		
		void AddData(wstring str, const wstring& strV)
		{
			AmfStringPtr pStr(HP_NEW);
			pStr->SetValue(strV.c_str());
			m_DataMap[str] = pStr;
		}

		void AddData(wstring str, const string& strV)
		{
			wstring temp = AToW(strV);
			AddData(str,temp);
		}

		void AddData(wstring str, const char* strV)
		{
			wstring temp = AToW(strV);
			AddData(str,temp);
		}
		
		void AddData(wstring str, float64 d)
		{
			AmfDoublePtr pD(HP_NEW);
			pD->SetValue(d);
			m_DataMap[str] = pD;
		}

		void AddData(wstring str, const MilliTime& t)
		{
			AmfDatePtr pD(HP_NEW);
			pD->SetValue(t);
			m_DataMap[str] = pD;
		}

		void AddData(wstring str, AmfObjectPtr obj)
		{
			m_DataMap[str] = obj;
		}

		bool DeleteData (wstring strKey)
		{
			return (m_DataMap.erase(strKey) > 0);
		}

		virtual AmfObjectPtr Item (const wchar_t* str)
		{
			MapStrPtr::iterator it = m_DataMap.find(str);
			if (it != m_DataMap.end())
				return (*it).second;
			else
			{
				std::stringstream stm;
				stm << "Item ['" << WToU8(str) << "'] not exist!";
				throw HT::Except(HT_AMF_ITEM_NOT_EXIST, stm.str().c_str());
			}
		}

		// use Find, if the item not exist, the function will return an NULL.
		// not like Item to throw an exception
		AmfObjectPtr Find (const wchar_t* str)
		{
			MapStrPtr::iterator it = m_DataMap.find(str);
			if (it != m_DataMap.end())
				return (*it).second;
			else
				return NULL;
		}

		AmfObjectPtr Find (const wstring& str) { return Find(str.c_str()); }

		virtual int32 DataType()
		{
			return AMF3_OBJECT;
		};

		virtual int32 GetChildNumber() { return m_DataMap.size(); }
		virtual AmfIteratorPtr GetChildIterator();

		MapStrPtr& GetValue()
		{
			return m_DataMap;
		}
		
	private:
		MapStrPtr m_DataMap;
		wstring m_strName;
	};


/************************************************************************/
/* Inlines
/************************************************************************/
inline int32 AmfIterator::AsInt () { return Get()->ToInt();	}
inline float64 AmfIterator::AsDouble () { return Get()->ToDouble(); }
inline wstring AmfIterator::AsString () { return Get()->ToString(); }
inline AmfObjectPtr ToAmf () {	return AmfObject::GetNullObject(); }
inline AmfObjectPtr ToAmf (bool v) { AmfBoolPtr p(HP_NEW); p->SetValue(v); return p; }
inline AmfObjectPtr ToAmf (int32 v) { AmfIntPtr p(HP_NEW); p->SetValue(v); return p; }
inline AmfObjectPtr ToAmf (float64 v) { AmfDoublePtr p(HP_NEW); p->SetValue(v); return p; }
inline AmfObjectPtr ToAmf (LPCWSTR v) { AmfStringPtr p(HP_NEW); p->SetValue(v); return p; }
inline AmfObjectPtr ToAmf (std::wstring v) { AmfStringPtr p(HP_NEW); p->SetValue(v.c_str()); return p; }
inline AmfObjectPtr ToAmf (std::string v) { AmfStringPtr p(HP_NEW); p->SetValue(U8ToW(v).c_str()); return p; }
inline AmfObjectPtr ToAmf (const MilliTime& t) { AmfDatePtr p(HP_NEW); p->SetValue(t); return p; }
inline AmfObjectPtr ToAmf (AmfObjectPtr p) { return p; }
// to Array direct, for example:
// ... = ToArray (ToAmf(32), ToAmf("Sample String"), ToAmf(true));
inline AmfArrayPtr ToArray()
{ AmfArrayPtr pArray(HP_NEW);	return pArray;}
inline AmfArrayPtr ToArray(AmfObjectPtr p1)
{ AmfArrayPtr pArray(HP_NEW);	pArray->AddData(p1); return pArray;}
inline AmfArrayPtr ToArray(AmfObjectPtr p1,AmfObjectPtr p2)
{ AmfArrayPtr pArray(HP_NEW);	pArray->AddData(p1); pArray->AddData(p2); return pArray;}
inline AmfArrayPtr ToArray(AmfObjectPtr p1,AmfObjectPtr p2,AmfObjectPtr p3)
{ AmfArrayPtr pArray(HP_NEW);pArray->AddData(p1);	pArray->AddData(p2); pArray->AddData(p3); return pArray; }
inline AmfArrayPtr ToArray(AmfObjectPtr p1,AmfObjectPtr p2, AmfObjectPtr p3, AmfObjectPtr p4)
{ AmfArrayPtr pArray(HP_NEW);	pArray->AddData(p1); pArray->AddData(p2); pArray->AddData(p3); pArray->AddData(p4);	return pArray; }
inline AmfArrayPtr ToArray(AmfObjectPtr p1, AmfObjectPtr p2, AmfObjectPtr p3, AmfObjectPtr p4, AmfObjectPtr p5)
{ AmfArrayPtr pArray(HP_NEW);	pArray->AddData(p1); pArray->AddData(p2); pArray->AddData(p3); pArray->AddData(p4); pArray->AddData(p5); return pArray; }
inline AmfArrayPtr ToArray(AmfObjectPtr p1, AmfObjectPtr p2, AmfObjectPtr p3, AmfObjectPtr p4, AmfObjectPtr p5, AmfObjectPtr p6)
{ AmfArrayPtr pArray(HP_NEW);	pArray->AddData(p1); pArray->AddData(p2); pArray->AddData(p3); pArray->AddData(p4);	pArray->AddData(p5); pArray->AddData(p6); return pArray; }
inline AmfArrayPtr ToArray(AmfObjectPtr p1, AmfObjectPtr p2, AmfObjectPtr p3, AmfObjectPtr p4, AmfObjectPtr p5, AmfObjectPtr p6, AmfObjectPtr p7)
{ AmfArrayPtr pArray(HP_NEW); pArray->AddData(p1); pArray->AddData(p2); pArray->AddData(p3); pArray->AddData(p4); pArray->AddData(p5); pArray->AddData(p6); pArray->AddData(p7); return pArray; }
inline AmfArrayPtr ToArray(AmfObjectPtr p1, AmfObjectPtr p2, AmfObjectPtr p3, AmfObjectPtr p4, AmfObjectPtr p5, AmfObjectPtr p6, AmfObjectPtr p7, AmfObjectPtr p8)
{ AmfArrayPtr pArray(HP_NEW); pArray->AddData(p1); pArray->AddData(p2); pArray->AddData(p3); pArray->AddData(p4); pArray->AddData(p5); pArray->AddData(p6); pArray->AddData(p7); pArray->AddData(p8); return pArray; }
inline AmfArrayPtr ToArray(AmfObjectPtr p1, AmfObjectPtr p2, AmfObjectPtr p3, AmfObjectPtr p4, AmfObjectPtr p5, AmfObjectPtr p6, AmfObjectPtr p7, AmfObjectPtr p8, AmfObjectPtr p9)
{ AmfArrayPtr pArray(HP_NEW); pArray->AddData(p1); pArray->AddData(p2); pArray->AddData(p3); pArray->AddData(p4); pArray->AddData(p5); pArray->AddData(p6); pArray->AddData(p7); pArray->AddData(p8); pArray->AddData(p9); return pArray; }
inline AmfArrayPtr ToArray(AmfObjectPtr p1, AmfObjectPtr p2, AmfObjectPtr p3, AmfObjectPtr p4, AmfObjectPtr p5, AmfObjectPtr p6, AmfObjectPtr p7, AmfObjectPtr p8, AmfObjectPtr p9, AmfObjectPtr p10)
{ AmfArrayPtr pArray(HP_NEW); pArray->AddData(p1); pArray->AddData(p2); pArray->AddData(p3); pArray->AddData(p4); pArray->AddData(p5); pArray->AddData(p6); pArray->AddData(p7); pArray->AddData(p8); pArray->AddData(p9); pArray->AddData(p10); return pArray; }

} //namespace Amf

#endif // !defined(AFX_AMFOBJECT_H__5B369AA6_BFEC_446D_BBCF_0CE98C023687__INCLUDED_)
